#pragma once
#include <memory>
#include <string>
#include <vector>

#include "syralink.hpp"

namespace sl {

class Connection : public NonCopyable {
  protected:
    virtual size_t on_recv(std::vector<sl::byte>& buffer) = 0;
  public:
    virtual void async_read() = 0;
};

class Acceptor : public NonCopyable {
  public:
    virtual std::shared_ptr<Connection> accept() = 0;
};

std::shared_ptr<Acceptor> listen(int port, std::string_view ip = "0.0.0.0");
std::shared_ptr<Connection> connect(int port, std::string_view ip = "0.0.0.0");

} // namespace sl

